package headfirst.designpatterns.factory.a_pizzas_simpleFactory.z_run_test;

import headfirst.designpatterns.factory.a_pizzas_simpleFactory.pizza.Pizza;
import headfirst.designpatterns.factory.a_pizzas_simpleFactory.store.PizzaStore;
import headfirst.designpatterns.factory.a_pizzas_simpleFactory.factory.SimplePizzaFactory;

/**
 * 测试
 * 重点：
 * 		将创建子类的方法拿出来封装成工厂方法
 *
 * 	即把new操作符 替换 成工厂对象的创建方法，不再使用具体的实力化
 */
public class PizzaTestDrive {
 
	public static void main(String[] args) {
		SimplePizzaFactory factory = new SimplePizzaFactory();
		PizzaStore store = new PizzaStore(factory);

		Pizza pizza = store.orderPizza("cheese");
		System.out.println("We ordered a " + pizza.getName() + "\n");
		System.out.println(pizza);
 
		pizza = store.orderPizza("veggie");
		System.out.println("We ordered a " + pizza.getName() + "\n");
		System.out.println(pizza);
	}
}
